package com.lhkj.ct.meta.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lhkj.ct.base.model.UserAuthInfo;
import com.lhkj.ct.meta.admin.model.dto.EmpPageQuery;
import com.lhkj.ct.meta.admin.model.entity.TblEmployee;
import com.lhkj.ct.meta.admin.model.vo.EmpPageVo;
import com.lhkj.ct.meta.admin.model.vo.UserProfile;
import org.apache.ibatis.annotations.*;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2023-08-23
 */
public interface SysEmployeeMapper extends BaseMapper<TblEmployee> {

    /**
     * 根据账号查询登录信息
     */
    @Select("select e.id as user_id, e.emp_no as username, e.emp_name as `name`, e.`password`, e.dept_id, o.id as organ_id, e.emp_status as `status`,o.status as `org_status`, o.del_flag as `org_del_flag` from tbl_employee e " +
            "left join tbl_organ o on e.organ_id = o.id " +
            "where emp_no = #{username,jdbcType=VARCHAR} and e.del_flag = 0 and o.del_flag = 0")
    UserAuthInfo getUserAuthInfo(String username);

    IPage<EmpPageVo> selectEmpPage(Page<TblEmployee> page, @Param("query") EmpPageQuery employee);

    IPage<EmpPageVo> selectEmpOptions(Page<TblEmployee> page,@Param("query") EmpPageQuery pageQuery);
    /**
     * 获取个人信息
     */
    UserProfile getUserProfile(String userId);
}
